<template>
  <div id="cpn-TableBtnBar-field">
    <div class="left">
      <slot name="left"></slot>
    </div>
    <div class="center">
      <slot name="center"></slot>
    </div>
    <div class="right">
      <slot name="right"></slot>
      <el-button type="primary" @click.native="confirm">{{ confirmStr }}</el-button>
      <el-button type="primary" plain v-if="isCancelShow" @click.native="cancel">{{ cancelStr }}</el-button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'tableBtnBar-field',
  props: {
    confirmStr: {
      typeof: String,
      default: '确定'
    },
    cancelStr: {
      typeof: String,
      default: '取消'
    },
    isCancelShow: {
      typeof: Boolean,
      default: true
    }
  },
  methods: {
    confirm() {
      this.$emit('confirm')
    },
    cancel() {
      this.$emit('cancel')
    }
  }
}
</script>

<style lang="scss" scoped>
#cpn-TableBtnBar-field {
  display: flex;
  justify-content: space-between;
  padding: 5px;
}
</style>